// tTrig.C -- time to trigger
inline void a(vector<TH1 *> &v, TObject *h){ v.push_back((TH1 *)h); }
void tTrig(){
  TFile *f = new TFile(getenv("TMP1"));
  TTree *etf = (TTree *)f->Get("etf");

  TCanvas *c = new TCanvas("c", "Time To Trigger", 1680, 1050);
  c->Divide(2, 2);
  for(int i = 4; i--;) c->cd(i+1)->SetLogz(1);
  c->cd(1);
  if(etf->GetBranch("tchpxi0"))
    etf->Draw("tchpxi0.time():tchpxi0.chid()>>h0(4001, -0.5, 4000.5., 500, -200., 2200.)", "tchpxi0.nl()>0", "colz");

  c->cd(2);
  if(etf->GetBranch("tchpxi1"))
    etf->Draw("tchpxi1.time():tchpxi1.chid()>>h1(401, 3949.5, 4350.5., 500, -200., 5200.)", "tchpxi1.nl()>0", "colz");

  c->cd(3);
  if(etf->GetBranch("tchpxi0"))
    etf->Draw("tchpxi0.nl():tchpxi0.chid()>>h2(4001, -0.5, 4000.5., 11, -2.5, 8.5)", "", "colz");

  c->cd(4);
  if(etf->GetBranch("tchpxi0"))
    etf->Draw("tchpxi0.nt():tchpxi0.chid()>>h3(4001, -0.5, 4000.5., 11, -2.5, 8.5)", "", "colz");

  c->Print("raw1.pdf");
} // end raw
